////////////////////////////////////////////////////////////////////////////////
// Copyright (c) 2008 T. Scot Clausing
//	http://blog.tsclausing.com
//	http://deploydaily.com
// 
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
////////////////////////////////////////////////////////////////////////////////
package com.deploydaily.mysimplemp3
{
	import flash.media.ID3Info;
	
	internal interface ISimpleMP3
	{
		
		//--------------------
		// EVENTS 
		//--------------------
		/* 
		[com.deploydaily.mysimplemp3.SimpleMP3ProgressEvent] .progressCurrent, .progressTotal
		loadingProgressEvent
		playbackProgressEvent
		
		[flash.events.Event]
		loadingBegin
		loadingId3Complete
		loadingComplete
		playbackBegin		play from position 0
		playbackPlay
		playbackPause
		playbackResume		play from position > 0 && < playbackLength
		playbackStop
		playbackComplete	
		scrubBegin
		scrub
		scrubEnd
		*/
		
		
		//--------------------
		// BASIC CONTROLS
		//--------------------
		function load( location:String=null ) :Boolean; // returns false if could not load
		function play() :void;
		function pause() :void;
		function stop() :void;
		function scrubBegin() :void; 			// called to initiate dragging scrub
		function scrub( position:Number ) :void;// pass the position in milliseconds
		function scrubEnd() :void; 				// called to end dragging scrub
		
		
		//--------------------
		// BINDABLE READ-ONLY
		//--------------------
		function get state() :String // from SimpleMP3States
									 // "", loading, playing, streaming, buffering, paused, stopped
		function get isIdle() :Boolean;
		function get isLoading() :Boolean;
		function get isPlaying() :Boolean;
		function get isStreaming() :Boolean;
		function get isBuffering() :Boolean;
		function get isPaused() :Boolean;
		function get isStopped() :Boolean;
		function get isScrubbing() :Boolean;
		
		function get bytesTotal() :uint;
		function get bytesLoaded() :uint;
		function get bytesLoadedPercentage() :Number;
		
		function get playbackLength() :Number;
		function get playbackPosition() :Number;
		function get playbackPositionPercentage() :Number;
		
		function get id3() :ID3Info;
		
		
		//--------------------
		// PPROPERTY ACCESSORS
		//--------------------
		function set url( value:String ) :void; // url to the mp3 file.  set with load(String) or url accessor.
		function get url() :String;
		
		function set autoLoad( value:Boolean ) :void; // automatically load when url is set
		function get autoLoad() :Boolean;
		
		function set autoPlay( value:Boolean ) :void; // automatically play when file is loaded
		function get autoPlay() :Boolean;
		
		function set autoRewind( value:Boolean ) :void; // automatically rewind when sound is complete
		function get autoRewind() :Boolean;
		
		function set repeat( value:Boolean ) :void; // replay when finished playing
		function get repeat() :Boolean;
		
		function set volume( value:Number ) :void; // volume of the current sound channel from 0 to 1
		function get volume() :Number;
		
		function set panning( value:Number ) :void; // -1 (left) to 0 (center) to 1 (right)
		function get panning() :Number;
		
		function set stream( value:Boolean ) :void; // stream?  (begin playing while loading)
		function get stream() :Boolean;
		
		function set streamingBufferTime( milliseconds:uint ) :void;
		function get streamingBufferTime() :uint;
		
		function set checkPolicyFile( value:Boolean ) :void; // check for crossdomain.xml?
		function get checkPolicyFile() :Boolean;
	}
}